package com.huizluo.module4.student;

import java.util.HashMap;

public class RemoveCommand extends Command {

    private Store database;

    public RemoveCommand(String commandName, String commandDesc, Store database) {
        super(commandName,commandDesc);
        this.database = database;
    }

    @Override
    public void notise(){
        System.out.println("请输入学生信: id=xx");
    }

    @Override
    public void run(HashMap<String, String> args) throws Exception {
        int id = Integer.parseInt(args.get("id"));
        if ( id == 0 ){
            throw new Exception("参数错误");
        }
        Student s = new Student(id,"");
        Item item = new Item();
        item.ID = id;
        this.database.Remove(item);
        System.out.println("操作成功");
    }
}
